package com.lovo.service.impl;

import com.lovo.bean.ClassBean;
import com.lovo.dao.IClassDAO;
import com.lovo.service.IClassService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class ClassServiceImpl implements IClassService {
    @Resource
    private IClassDAO classDAO;
    @Override
    public List selectAll() {
        return classDAO.findAll();
    }

    @Override
    public ClassBean selectById(Long id) {
        return classDAO.findById(id).get();
    }

    @Override
    public void add(ClassBean classBean) {
        classDAO.save(classBean);
    }

    @Override
    public void update(ClassBean classBean) {
        classDAO.save(classBean);
    }

    @Override
    public void delete(Long id) {
        classDAO.deleteById(id);
    }
}
